Preventing Cross-Type Aliasing for More Practical Reasoning

نویسندگان

  • Krishna Kishore Dhara
  • Gary T. Leavens
چکیده

To reason about the correctness of a method when cross-type aliases are possible, one must not only consider all possible patterns of aliasing among the method’s arguments, but all possible ways in which these types’ abstract (specification-only) fields may be aliased. Because of the large number of such aliasing possibilities, and because of the complications they cause for reasoning, cross-type aliases make the use of method specifications impractical in reasoning about correctness. Hence, existing work on behavioral subtyping either ignores aliasing or prohibits the use of method specifications in reasoning We present a simple type system that prohibits cross-type aliases, and thus eliminates these problems. The “viewpoint restriction” enforced by this type system supports a less restrictive notion of behavioral subtyping — weak behavioral subtyping. Weak behavioral subtyping allows types with immutable objects (e.g., immutable sequences), to have behavioral subtypes with mutable objects (e.g., mutable arrays). Thus, besides permitting one to reason with method specifications, the viewpoint restriction also permits a more flexible and useful notion of behavioral subtyping.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Modular Reasoning, and Weak Behavioral Subtyping

Existing work on behavioral subtyping either ignores aliasing or restricts the behavior of additional methods in a subtype and only allows one to use invariants and history constraints in reasoning. This prevents many useful subtype relationships; for example, a type with immutable objects (e.g., immutable sequences), cannot have a behavioral subtype with mutable objects (e.g., mutable arrays)....

متن کامل

Behavioral Subtyping in Object-Oriented Languages

Modularity and code reuse are two important features of object-oriented programming. Modularity means that adding new components does not require reveri cation or respeci cation of existing components. A common form of reuse in objectoriented programs is to add new subtypes to existing types and to invoke already existing procedures with objects of these new types. In such cases, behavior of pr...

متن کامل

Lightweight Linear Types in System F◦

We present System F◦, an extension of System F that uses kinds to distinguish between linear and unrestricted types, simplifying the use of linearity for general-purpose programming. We demonstrate through examples how System F◦ can elegantly express many useful protocols, and we prove that any protocol representable as a DFA can be encoded as an F◦ type. We supply mechanized proofs of System F...

متن کامل

Typestates for Objects

Today’s mainstream object-oriented compilers and tools do not support declaring and statically checking simple preand postconditions on methods and invariants on object representations. The main technical problem preventing static verification is reasoning about the sharing relationships among objects as well as where object invariants should hold. We have developed a programming model of types...

متن کامل

Mutation, Aliasing, Viewpoints, Modular Reasoning, and Weak Behavioral Subtyping

Existing work on behavioral subtyping either ignores aliasing or restricts the behavior of additional methods in a subtype and only allows one to use invariants and history constraints in reasoning. This prevents many useful subtype relationships; for example, a type with immutable objects (e.g., immutable sequences), cannot have a behavioral subtype with mutable objects (e.g., mutable arrays)....

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2001